<!DOCTYPE HTML>
<html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>

<div id="checkbox1" tabindex=0 role="checkbox" aria-checked="false">Test Checkbox</div>

<p id="description"></p>
<div id="console"></div>
<script>
async_test(function(t) {
    console.log('t ' + t);
    var accessibleCheckbox = accessibilityController.accessibleElementById("checkbox1");
    var notificationCount = 0;

    function listener(notification) {
        if (notification == "CheckedStateChanged")
            notificationCount++;
        console.log("notification " + notificationCount);

        if (notificationCount == 2) {
            accessibleCheckbox.removeNotificationListener(listener);
            t.done();
        }
    }
    accessibleCheckbox.addNotificationListener(listener);

    // Check the checkbox.
    document.getElementById('checkbox1').setAttribute('aria-checked', 'true');
    document.getElementById('checkbox1').setAttribute('aria-checked', 'false');
}, "This tests that checking of an aria checkbox sends a notification.");

</script>
</head>
</script>
</body>
</html>
